import Mock from 'mockjs';
// 拓展mockjs
Mock.Random.extend({
  phone: function () {
    return Mock.mock(/(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}/) //Number()
  }
});

// 生成公司
const createCompany = (len0: number, len1: number, str: string) => {
  return Mock.Random.cword(len0, len1) + str
}
export const initData = [
  {
    name: '随机中文',
    content: Mock.Random.cword( 10 ),
    fn: Mock.Random.cword.bind(Mock.Random),
    length: 10
  },
  {
    name: '中文段落',
    content: Mock.Random.cparagraph( 2 ),
    fn: Mock.Random.cparagraph.bind(Mock.Random),
    length: 2
  },
  {
    name: '英文字符',
    content: Mock.Random.word( 10 ),
    fn: Mock.Random.word.bind(Mock.Random),
    length: 10
  },
  {
    name: '英文单词',
    content: Mock.Random.sentence(5),
    fn: Mock.Random.sentence.bind(Mock.Random),
    length: 5
  },
  {
    name: '英文段落',
    content: Mock.Random.paragraph( 2 ),
    fn: Mock.Random.paragraph.bind(Mock.Random),
    length: 2
  },

  {
    name: '用户名',
    content: Mock.mock(/\w{5,20}/),
    fn: Mock.mock.bind(Mock),
    param: /\w{5,20}/
  },
  {
    name: '电话号码',
    content: Mock.Random.phone(),
    fn: Mock.Random.phone.bind(Mock.Random),
  },
  {
    name: '身份证号码',
    content: Mock.Random.id(),
    fn: Mock.Random.id.bind(Mock.Random),
  },{
    name: '电子邮件',
    content: Mock.Random.email(),
    fn: Mock.Random.email.bind(Mock.Random),
  },{
    name: '日期',
    content: Mock.Random.now('yyyy-MM-dd HH:mm:ss'),
    fn: Mock.Random.now.bind(Mock.Random),
    param: 'yyyy-MM-dd HH:mm:ss'
  },{
    name: '中文姓名',
    content: Mock.Random.cname(),
    fn: Mock.Random.cname.bind(Mock.Random)
  },{
    name: '英文姓名',
    content: Mock.Random.name(),
    fn: Mock.Random.name.bind(Mock.Random)
  },{
    name: '公司名字',
    content: createCompany(3,5, '有限股份公司'),
    fn: createCompany,
    param: [3,5,'有限公司']
  },{
    name: '地址',
    content: Mock.Random.county(true),
    fn: Mock.Random.county.bind(Mock.Random),
    param: true
  },{
    name: '网址',
    content: Mock.Random.url('https'),
    fn: Mock.Random.url.bind(Mock.Random),
    param: 'https'
  },{
    name: 'IP',
    content: Mock.Random.ip(),
    fn: Mock.Random.ip.bind(Mock.Random)
  },{
    name: 'GUID',
    content: Mock.Random.guid(),
    fn: Mock.Random.guid.bind(Mock.Random),
  },{
    name: '图片地址',
    content: Mock.Random.image('200x100'),
    fn: Mock.Random.image.bind(Mock.Random),
    param: '200x100'
  },
]